home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _1E131451147C4AAAA30CD8BACD7214C0 < prev    next >
Encoding:
Text File  |  2004-01-06  |  6.3 KB  |  184 lines

  1. --------------------------------------------------
  2. --   Created By: Petar
  3. --   Description: This is the combat behaviour of the Cover
  4. --------------------------
  5. --   modified by: sten 22-10-2002
  6. --   modified amanda 02-11-19 moved roll animations to default.lua
  7.  
  8. AIBehaviour.CoverAttack = {
  9.     Name = "CoverAttack",
  10.  
  11.  
  12.  
  13.     ---------------------------------------------
  14.     OnKnownDamage = function ( self, entity, sender)
  15.         entity:InsertSubpipe(0,"not_so_random_hide_from",sender.id);
  16.     end,
  17.  
  18.     OnLeftLean  = function( self, entity, sender)
  19.         if (entity.Properties.special==1) then 
  20.             do return end
  21.         end
  22.         local rnd=random(1,10);
  23.         if (rnd > 5) then 
  24.             AI:Signal(0,1,"LEFT_LEAN_ENTER",entity.id);
  25.         end
  26.     end,
  27.     ---------------------------------------------
  28.     OnRightLean  = function( self, entity, sender)
  29.         if (entity.Properties.special==1) then 
  30.             do return end
  31.         end
  32.  
  33.         local rnd=random(1,10);
  34.         if (rnd > 5) then 
  35.             AI:Signal(0,1,"RIGHT_LEAN_ENTER",entity.id);
  36.         end
  37.     end,
  38.     ---------------------------------------------
  39.  
  40.     OnLowHideSpot = function( self, entity, sender)
  41.         if (entity.Properties.special==1) then 
  42.             do return end
  43.         end
  44.  
  45.         entity:SelectPipe(0,"dig_in_attack");
  46.     end,
  47.  
  48.     ---------------------------------------------
  49.     OnNoTarget = function( self, entity )
  50.         entity:Readibility("ENEMY_TARGET_LOST"); -- you will go to alert from here
  51.         entity:SelectPipe(0,"search_for_target");
  52.     end,
  53.     ---------------------------------------------
  54.     OnPlayerSeen = function( self, entity, fDistance )
  55.         entity:Readibility("THREATEN",1);
  56.         if (fDistance>10) then
  57.             entity:SelectPipe(0,"cover_pindown");
  58.         else
  59.             entity:SelectPipe(0,"cover_scramble");
  60.         end
  61.     end,
  62.     ---------------------------------------------
  63.     OnEnemyMemory = function( self, entity )
  64.     end,
  65.     ---------------------------------------------
  66.     OnInterestingSoundHeard = function( self, entity )
  67.         -- called when the enemy hears an interesting sound
  68.         entity:Readibility("RELOADING",1);
  69.         entity:SelectPipe(0,"seek_target");
  70.     end,
  71.     ---------------------------------------------
  72.     OnThreateningSoundHeard = function( self, entity )
  73.         -- called when the enemy hears a scary sound
  74.     end,
  75.     ---------------------------------------------
  76.     OnReload = function( self, entity )
  77.         -- called when the enemy goes into automatic reload after its clip is empty
  78.         entity:SelectPipe(0,"cover_scramble");
  79.     end,
  80.     ---------------------------------------------
  81.     OnGroupMemberDied = function( self, entity )
  82.         -- called when a member of the group dies
  83.  
  84.         -- PETAR : Cover in attack should not care who died or not. He is too busy 
  85.         -- watching over his own ass :)
  86.     end,
  87.     --------------------------------------------------
  88.     OnGroupMemberDiedNearest = function ( self, entity, sender)
  89.         AIBehaviour.DEFAULT:OnGroupMemberDiedNearest(entity,sender);    
  90.     end,
  91.     ---------------------------------------------
  92.     OnNoHidingPlace = function( self, entity, sender )
  93.         -- select random attack pipe        
  94.         NOCOVER:SelectAttack(entity);
  95.         entity:Readibility("THREATEN",1);
  96.     end,    
  97.     ---------------------------------------------
  98.     OnReceivingDamage = function ( self, entity, sender)
  99.         -- called when the enemy is damaged
  100.  
  101.         entity:SelectPipe(0,"cover_scramble");
  102.  
  103.         -- call default handling
  104.         AIBehaviour.DEFAULT:OnReceivingDamage(entity,sender);
  105.     end,
  106.     --------------------------------------------------
  107.     OnBulletRain = function ( self, entity, sender)
  108.     end,
  109.     --------------------------------------------------
  110.     OnClipNearlyEmpty = function ( self, entity, sender)
  111.         entity:SelectPipe(0,"cover_scramble");
  112.     end,
  113.     --------------------------------------------------
  114.     -- CUSTOM SIGNALS
  115.     --------------------------------------------------
  116.     COVER_NORMALATTACK = function (self, entity, sender)
  117.         entity:SelectPipe(0,"cover_pindown");
  118.         entity:InsertSubpipe(0,"reload");
  119.     end,
  120.     ---------------------------------------------
  121.     AISF_GoOn = function (self, entity, sender)
  122.         entity:SelectPipe(0,"cover_scramble");
  123.     end,
  124.     ---------------------------------------------
  125.     HEADS_UP_GUYS = function (self, entity, sender)
  126.         -- do nothing on this signal
  127.         entity.RunToTrigger = 1;
  128.     end,
  129.     ---------------------------------------------
  130.     INCOMING_FIRE = function (self, entity, sender)
  131.         -- do nothing on this signal
  132.     end,
  133.     --------------------------------------------------
  134.     -- GROUP SIGNALS
  135.     --------------------------------------------------
  136.     KEEP_FORMATION = function (self, entity, sender)
  137.         -- the team leader wants everyone to keep formation
  138.     end,
  139.     ---------------------------------------------    
  140.     BREAK_FORMATION = function (self, entity, sender)
  141.         -- the team can split
  142.     end,
  143.     ---------------------------------------------    
  144.     SINGLE_GO = function (self, entity, sender)
  145.         -- the team leader has instructed this group member to approach the enemy
  146.     end,
  147.     ---------------------------------------------    
  148.     GROUP_COVER = function (self, entity, sender)
  149.         -- the team leader has instructed this group member to cover his friends
  150.     end,
  151.     ---------------------------------------------    
  152.     IN_POSITION = function (self, entity, sender)
  153.         -- some member of the group is safely in position
  154.     end,
  155.     ---------------------------------------------    
  156.     GROUP_SPLIT = function (self, entity, sender)
  157.         -- team leader instructs group to split
  158.     end,
  159.     ---------------------------------------------    
  160.     PHASE_RED_ATTACK = function (self, entity, sender)
  161.         -- team leader instructs red team to attack
  162.     end,
  163.     ---------------------------------------------    
  164.     PHASE_BLACK_ATTACK = function (self, entity, sender)
  165.         -- team leader instructs black team to attack
  166.     end,
  167.     ---------------------------------------------    
  168.     GROUP_MERGE = function (self, entity, sender)
  169.         -- team leader instructs groups to merge into a team again
  170.     end,
  171.     ---------------------------------------------    
  172.     CLOSE_IN_PHASE = function (self, entity, sender)
  173.         -- team leader instructs groups to initiate part one of assault fire maneuver
  174.     end,
  175.     ---------------------------------------------    
  176.     ASSAULT_PHASE = function (self, entity, sender)
  177.         -- team leader instructs groups to initiate part one of assault fire maneuver
  178.     end,
  179.     ---------------------------------------------    
  180.     GROUP_NEUTRALISED = function (self, entity, sender)
  181.         -- team leader instructs groups to initiate part one of assault fire maneuver
  182.     end,
  183.  
  184. }